{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6ab59fd0",
   "metadata": {},
   "source": [
    "## np.eye()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "2aa7b2bc",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1. 0. 0.]\n",
      " [0. 1. 0.]\n",
      " [0. 0. 1.]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "# p.eye()`生成一个单位矩阵（对角线为1，其余元素为0）。它用于创建方阵\n",
    "arr = np.eye(3)  # 创建3x3的单位矩阵\n",
    "print(arr) "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ffdc1b8b",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
